<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
  
</body>
<script>

    //工厂函数；
    //   function createobj(name){
    //     var obj ={}
    //     obj.name =name,
    //     obj.material = []
    //     return obj
    // }
    // var obj1 =  createobj('蒸羊羔')
    //  console.log(obj1)
    //  var obj2 =  createobj('烤羊肉')
    //  console.log(obj1)
     //自定义构造函数
    //   var obj1 = new createobj('狮子头')







     function createobj(name){
        this.name = name
        this.materil = []
        this.cook = function(){

        }
     }
     var obj1 = new createobj('蒸羊羔')
     var obj2 = new createobj('烧兔子')
      console.log(obj1,obj2)
</script>
</html>